package com.ioidea.holland

fun main() {
    val hexString = "E803"
    val reversedHexString = reverseHexString(hexString)
    val decimalValue = reversedHexString.toInt(16)
    println(decimalValue)  // 输出：1000
}

fun reverseHexString(hexString: String): String {
    val reversedHex = StringBuilder()
    for (i in hexString.length - 2 downTo 0 step 2) {
        reversedHex.append(hexString.substring(i, i + 2))
    }
    return reversedHex.toString()
}